package com.bdqn.service;

import com.bdqn.mapper.SysRoleMapper;
import com.bdqn.pojo.SysRole;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
* SysRoleService服务层实现类
*/
@Service("sysRoleService")
public class SysRoleServiceImpl implements SysRoleService {

    @Resource // 使用注解的方式将DAO层的Bean注入
    private SysRoleMapper sysRoleMapper;

    /**
     * 获得用户列表
     *
     * @return
     */
    @Override
    public List<SysRole> getList() {
        return sysRoleMapper.selectSysRoleList();
    }


    @Override
    public boolean update(SysRole sysRole) {
        sysRole.setUpdatedTime(new Date());
        return sysRoleMapper.update(sysRole);
    }

    @Override
    public SysRole queryId(Integer id) {
        return sysRoleMapper.queryId(id);
    }

    @Override
    public boolean delete(Integer roleid) {
        return sysRoleMapper.delete(roleid) == 1;
    }

    @Override
    public SysRole queryCode(String code) {
        return sysRoleMapper.queryCode(code);
    }

    @Override
    public boolean add(SysRole sysRole) {
        return sysRoleMapper.add(sysRole) == 1;
    }
}
